const headers = {
  'Cache-Control': 'no-cache, no-store, must-revalidate',
  Pragma: 'no-cache',
  Expires: 0,
  credentials: 'same-origin',
  'Access-Control-Allow-Origin': '*',
  Connection: 'keep-alive'
};

const bypass = (req, res, proxyOptions) => {
  const goUrl = `${proxyOptions.target}${req.url}`;
  console.log(`****** ${req.method}: ${goUrl}`);
};

const common = {
  headers,
}

const proxy = {
  '/mock/': {
    ...common,
    target: 'http://localhost:5050',
    bypass,
    changeOrigin: true
  }
};

module.exports = proxy;